package com.ocom.common.enums;

public enum PayStateEnum {

	/**
	 * 支付状态；0支付中、1支付成功，2支付失败，3撤单中，4已撤单，5退款中，6已退款，7部分退款成功
     */
    DELAYPAY(-11,"延迟代扣"),
    PAYING(0,"支付中"),
    SUCC(1,"支付成功"),
    FAIL(2,"支付失败"),
    CHEDAN(3,"撤单中"),
    READY(4,"已撤单"),
    REPAYING(5,"退款中"),
    RE(6,"已退款"),

    DESTORY(7,"部分退款成功");
    // 成员变量

    private final Integer key;
    private final String msg;

    PayStateEnum(Integer key, String msg) {
        this.key = key;
        this.msg = msg;
    }

    public Integer getKey() {
        return key;
    }

    public String getMsg() {
        return msg;
    }

    /**
     * 根据key获取value
     *
     * @param key : 键值key
     * @return String
     */
    public static String getValueByKey(Integer key) {
        PayStateEnum[] enums = PayStateEnum.values();
        for (int i = 0; i < enums.length; i++) {
            if (enums[i].getKey().equals(key)) {
                return enums[i].getMsg();
            }
        }
        return "";
    }
}
